home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1418_window_does_not_display.rtf < prev    next >
Text File  |  1993-11-08  |  2KB  |  52 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fmodern Ohlfs;}
  2. \paperw12060
  3. \paperh10800
  4. \margl120
  5. \margr120
  6. {\colortbl;\red0\green0\blue0;\red84\green84\blue84;\red83\green83\blue83;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  In my application when my window becomes the key window or the main window, sometimes it doesn't display itself.  What's going on?\
  8. \
  9. A:  
  10. \fc1\cf1 There is a bug where 
  11. \b display
  12. \b0  sometimes is disabled in a Window when the window becomes key and/or main.   The result is that a window (or its delegate) tries to do some drawing in its 
  13. \b becomeKeyWindow
  14. \b0  or 
  15. \b becomeMainWindow
  16. \b0  (or 
  17. \b windowDidBecomeKey:
  18. \b0  or 
  19. \b windowDidBecomeMain:
  20. \b0 ) method, and the drawing doesn't happen because some drawer observes that display is disabled.\
  21. \
  22. Here's a workaround.  You can do this little dance in either your delegate method or your override of Window's 
  23. \b becomeKeyWindow 
  24. \b0 or 
  25. \b windowDidBecomeMain
  26. \b0 .\
  27. \
  28.  
  29. \f1\fs24     - windowDidBecomeMain:win\
  30.     \{\
  31.         BOOL displayWasDisabledForActivation = [NXApp _isInvalid] &&\
  32.                                 ![win isDisplayEnabled];\
  33. \
  34.         if (displayWasDisabledForActivation)\
  35.         [win reenableDisplay];\
  36. \
  37.     /* whatever you do now... */\
  38. \
  39.         if (displayWasDisabledForActivation)\
  40.             [win disableDisplay];\
  41.         return self;\
  42.     \}\
  43.  
  44. \f0\fs28 \
  45. The _isInvalid method is a private method, and as such is undocumented.  Calling this ensures that you are in the case where this bug bites.  We thought this might be prudent in case there was a different time when you really would like display to be disabled. \
  46. \
  47. Valid for 2.0, 3.0\
  48. \
  49. QA661\
  50. \
  51.  
  52.